
import request from '@/utils/request'
import {formatDateTime} from '@/utils/dateUtil'
const api = {}

//查询所有角色
api.query = data => {
  const item = request({
    url: `/base/itouchSysRoles/query`,
    method: 'get',
    params: data
  })
  item.then(res => {
    res.data.page.list.forEach(item => {
      item.createTime = formatDateTime( new Date(item.createTime))
    });
  })
  return item
}

//查看用户人员
api.getListUserBy = data => {
  return request({
    url: `/base/itouchSysRoles/getListUserBy`,
    method: 'get',
    params: data
  })
}

//单查询角色信息
api.getByRoleId = roleId => {
  return request({
    url: `/base/itouchSysRoles/getRoleById?roleId=`+roleId,
    method: 'get'
  })
}

//删除
api.delRoleById = data => {
	return request({
    	url: `/base/itouchSysRoles/delRoleById`,
    	method: 'post',
    	data
  	})
}

//添加修改
api.saveOrUpdate = data => {
	return request({
    	url: `/base/itouchSysRoles/saveOrUpdate`,
    	method: 'post',
    	data
  	})
}

export default api
